package 面向对象作业1;

public class Point {
    private int   x;
    private int   y;

    public Point() {
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
    public    void   yiX(int  x1){
        x=x+x1;
    }
    public    void   yiY(int   y1){
        y=y+y1;
    }

    @Override
    public String toString() {
        return "("+x+","+y+")";
    }
    //求俩点之间距离
    public double   juLi(int x,int y,int  x1,int   y1 ){
        int  x2=(x-x1)*(x-x1);
        int  y2=(y-y1)*(y-y1);
        int   z=x2+y2;
        double v = Math.sqrt(z);
        return   v;
    }
    public    double   XZhengXuan(int  x,int  y,int   x1,int   y1){
        int  x2=(x-x1)*(x-x1);
        int  y2=(y-y1)*(y-y1);
        int   z=x2+y2;
        double v = Math.sqrt(z);
        return   y1/v;
    }
    public    double   XYuxuan(int   x,int   y,int   x1,int   y1){
        int  x2=(x-x1)*(x-x1);
        int  y2=(y-y1)*(y-y1);
        int   z=x2+y2;
        double v = Math.sqrt(z);
        return   x1/v;
    }
}
